package kz.kstu.scantest.business.server.impl;

import kz.kstu.scantest.business.entity.CommonEntityConstant;
import kz.kstu.scantest.business.entity.guide.School;
import kz.kstu.scantest.business.server.api.GuideService;

import javax.persistence.Query;
import java.util.List;

/**
 * @author Filipp_Stankevich
 *         created: 26.07.11 19:34
 */
public class GuideServiceImpl extends AbstractService implements GuideService {


    @Override
    public List<School> findSchools() {
        Query query = getEntityManager().createNamedQuery(CommonEntityConstant.FIND_SCHOOLS);
        return query.getResultList();
    }

    @Override
    public School saveSchool(School school) {
       return save(school);
    }

    @Override
    public void removeSchool(School school) {
        remove(School.class, school.getId());
    }
}
